home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Run & Stumpy / source / specs.cp < prev    next >
Encoding:
Text File  |  1992-06-18  |  1.1 KB  |  55 lines  |  [TEXT/MPS ]

  1. #include <files.h>
  2. #include "volumeinfo.h"
  3. #include "specs.h"
  4.  
  5. #define parentofroot    0
  6.  
  7. extern OSErr rootfsspec( const Str31& name,
  8.                                  FSSpec& root )
  9.   {
  10.     volumeinfo info(name);
  11.     OSErr error= info.whatiswrong();
  12.     if ( error != noErr )
  13.         return error;
  14.     
  15.     return FSMakeFSSpec( info.refnum(),
  16.                                 parentofroot,
  17.                                 (ConstStr255Param)&name,
  18.                                 &root );
  19.   }
  20.  
  21. extern OSErr rootfsspec( int16 vrefnum,
  22.                                  FSSpec& root )
  23.   {
  24.     volumeinfo info(vrefnum);
  25.     OSErr error= info.whatiswrong();
  26.     if ( error != noErr )
  27.         return error;
  28.     
  29.     return FSMakeFSSpec( info.refnum(),
  30.                                 parentofroot,
  31.                                 (ConstStr255Param)&info.name(),
  32.                                 &root );
  33.   }
  34.  
  35. extern OSErr childfsspec( const FSSpec& parent,
  36.                                   const Str255& name,
  37.                                   FSSpec& child )
  38.   {
  39.     CInfoPBRec pb;
  40.     pb.dirInfo.ioCompletion = 0;
  41.     pb.dirInfo.ioNamePtr = (StringPtr)&parent.name;
  42.     pb.dirInfo.ioFDirIndex = 0;
  43.     pb.dirInfo.ioVRefNum= parent.vRefNum;
  44.     pb.dirInfo.ioDrDirID= parent.parID; 
  45.     
  46.     OSErr error= PBGetCatInfoSync( &pb );
  47.     if (error != noErr)
  48.         return error;
  49.     
  50.     return FSMakeFSSpec( parent.vRefNum,
  51.                                 pb.dirInfo.ioDrDirID,
  52.                                 (ConstStr255Param)&name,
  53.                                 &child );
  54.   }
  55.